package fruit;

import java.util.HashMap;
import java.util.Scanner;

public class Person {
    private String name;
    public Person(){}
    public Person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public HashMap<Shop,Integer> buyGoods(Shop [] shops){
        HashMap<Shop,Integer> bookList = new HashMap<>();
        while (true){
            System.out.println("请输入商品编号，按零退出");
            Scanner sc = new Scanner(System.in);
            int id = sc.nextInt();
            if(id==0){
                break;
            }else{
                System.out.println("请输入购买数量：");
                int number = sc.nextInt();
                for(int i = 0;i< shops.length;i++){
                    if(shops[i].getId()==id){
                        bookList.put(shops[i],number);
                        break;
                    }
                }
            }
        }
        return bookList;

    }

    public HashMap<Shop, Integer> buyGoods() {
        return null;
    }
}

